SA_LoadXML= function(xmlFile)
{
    var xmlDoc;
    if(window.ActiveXObject)
    {
        xmlDoc= new ActiveXObject('Microsoft.XMLDOM');
        xmlDoc.async    = false;
        xmlDoc.load(xmlFile);
    }
    else if (document.implementation&&document.implementation.createDocument)
    {
        xmlDoc    = document.implementation.createDocument('', '', null);
        xmlDoc.load(xmlFile);
    }
    else
    {
        return null;
    }
    
    return xmlDoc;
}


// 首先对xml对象进行判断
checkXMLDocObj    = function(xmlFile)
{
    var xmlDoc= SA_LoadXML(xmlFile);
    if(xmlDoc==null)
    {
        alert('您的浏览器不支持xml文件读取,于是本页面禁止您的操作,推荐使用IE5.0以上可以解决此问题!');
    }
    
    return xmlDoc;
}

initializeMenu= function(oid, xmlFile,subSysId)
{
		var xmlDoc = checkXMLDocObj(xmlFile);
		var isMultPannel=xmlDoc.getElementsByTagName("multPannel")[0].firstChild.nodeValue;
		
		var subsysModules  = xmlDoc.selectSingleNode("/project/subsys[@id='"+subSysId+"']");
		var displayStyle=subsysModules.getAttribute("style");
		var pageElement=document.getElementById("left_menu_main");
  	if(displayStyle=="default")
  		pageElement.className="left_menu_main";
  	else
  		pageElement.className="left_menu_fav";
    if(pageElement!=null && subsysModules!=null)
    {       
				if(subsysModules.childNodes.length>0)
				{
					var moduleCnt   = subsysModules.childNodes.length;
					var menuStr="";
					var subSysName=subsysModules.getAttribute("name");
					var navigationTitle;
					var module;
					var menu;
					var moduleName;
					var menuName;
					var menuUrl;
					for(var i=0;i<moduleCnt;i++)
					{         
						navigationTitle=subSysName;
						module=subsysModules.childNodes[i];
						moduleName=module.getAttribute("name");
						
						if(displayStyle=="favorite")
							menuStr+="<dl><dt><a href='javascript:sag_favorite_openclose(\"sag_menu_0"+(i+1)+"\",\"sag_menu_image_0"+(i+1)+"\");' title=\""+moduleName+"\"><img id=\"sag_menu_image_0"+(i+1)+"\" src=\"../resources/images/left-menu-arrow-up.gif\" alt=\"收缩菜单\" /><p>"+moduleName+"</p></a></dt>";
						else
							menuStr+="<dl><dt><a href='javascript:sag_menu_openclose(\"sag_menu_0"+(i+1)+"\");'>"+moduleName+"</a></dt>";
						if(module.childNodes.length>0)
						{
							menuStr+="<dd id=\"sag_menu_0"+(i+1)+"\" class=\"un_show\">";
							for(var j=0;j<module.childNodes.length;j++)
							{
								menu=module.childNodes[j];
								menuUrl=menu.getAttribute("url");
								menuName=menu.getAttribute("name");
								menuStr+="<span><img src=\"../resources/images/window-contrl.gif\" onclick=\"openWindow('"+menuUrl+"','"+menuName+"','"+subSysName+","+moduleName+","+menuName+"',false);\"/></span>";
						  	menuStr+="<a href=\"javascript:openWindow('"+menuUrl+"\','"+menuName+"','"+subSysName+","+moduleName+","+menuName+"',true);\" title='"+menuName+"'>"+menuName+"</a>";
							}
							menuStr+="</dd>";
						}
						menuStr+="</dl>";
					}
				}
				
				pageElement.innerHTML=menuStr;
    }
    
	}

